package cn.edu.nwsuaf.examcenter.service.serviceImpl;

import java.util.List;

import org.springframework.stereotype.Service;

import cn.edu.nwsuaf.examcenter.model.StudentScoreModel;
import cn.edu.nwsuaf.examcenter.pojo.StudentCourceScore;
import cn.edu.nwsuaf.examcenter.pojo.StudentCourceScoreId;
import cn.edu.nwsuaf.examcenter.service.StudentCourceScoreService;

@Service(value="studentCourceScoreService")
public class StudentCourceScoreServiceImpl extends BaseServiceImpl<StudentCourceScore> implements StudentCourceScoreService{

	@Override
	public void getStudentCourceScore(String studentNo, List<String> courceList, List<StudentScoreModel> modelList) {
		// TODO Auto-generated method stub
		for(int i = 0; i<courceList.size(); i++){
			StudentCourceScoreId id = new StudentCourceScoreId();
			id.setStudentNo(studentNo);
			id.setCourceNo(courceList.get(i));
			
			StudentCourceScore score = super.getById(StudentCourceScore.class, id);
			
			if(score==null){
				modelList.get(i).setTotalScore(0);
			}else{
				modelList.get(i).setTotalScore(score.getScore());
			}
		}
	}

}
